<template>
  <div>
    <div class="main">
      
      <van-field
        readonly
        class="input_text"
        name="CheckDate"
        v-model="form.CheckDate"
        label="日期"
        placeholder="请选择"
        required
      >
      </van-field>

      <van-field
        readonly
        class="input_text"
        name="MainChnName"
        v-model="form.MainChnName"
        label="责任人"
        placeholder="请选择"
        required
      >
      </van-field>
      <van-field
        readonly
        class="input_text"
        name="OrgName"
        v-model="form.OrgName"
        label="部门"
      >
      </van-field>

      <van-field
        readonly
        class="input_text"
        name="CheckContent"
        v-model="form.CheckContent"
        label="考核内容"
        required
      >
      </van-field>

      <van-field
      readonly
        label="考核结果"
        class="input_text"
        name="CheckResult"
        v-model="form.CheckResult"
        required
      >
      </van-field>
      <van-field
      readonly
        label="备注"
        class="input_text"
        name="Remarks"
        v-model="form.Remarks"
        required
      >
      </van-field>
    </div>
  </div>
</template>

<script>
import {
  initEntity,
  editSubmit,
  addSubmit,
  GetDetail,
} from "@/api/SiteProductCheckRecord";
import { formatDate, getDate, getTime } from "@/utils/getDate";
import { mapGetters } from "vuex";

export default {
  components: {
  },
  data() {
    return {
      id: this.$route.query.id,
      form: {},
    };
  },

  computed: {
    ...mapGetters(["baseUrl", "CompanyCode", "roles"]),
  },

  created() {
    if (this.$route.query.id != null) {
      (this.id = this.$route.query.id), this.getDetail();
    }

    console.log("id", this.$route.query.id);

    //this.getDistList();
  },
  activated() {
    // if (this.$route.params.certFile) {
    // 	this.fileList.push({
    // 		AttCode: this.$route.params.certFile.AttCode,
    // 		AttExt: this.$route.params.certFile.AttExt,
    // 		AttName: this.$route.params.certFile.AttName,
    // 	})
    // }
    //将该页面的id和新获取的id进行比对，如果不一致，说明页面应该进行数据刷新
    //重新请求数据
    // if (this.$route.params.userlist) {
    //   const userlist = this.$route.params.userlist;
    //   let EquManagerChnName = [];
    //   let EquManagerUserName = [];
    //   userlist.forEach((item) => {
    //     EquManagerChnName.push(item.name);
    //     EquManagerUserName.push(item.code);
    //   });
    //   this.form.EquManagerChnName = EquManagerChnName.join(",");
    //   this.form.EquManagerUserName = EquManagerUserName.join(",");
    // }
  },
  methods: {


    getDetail(certId) {
      let params = { id: this.id };

      
        GetDetail(params).then((res) => {
         res.data.CheckDate =  getDate(res.data.CheckDate );
          this.form = res.data;
        });
    },
  },
};
</script>

<style lang="less" >
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.block {
  width: 120px;
  height: 120px;
  background-color: #fff;
}
</style>
<style lang="less" scoped>
.space-between {
  justify-content: space-between;
}
</style>
